package com.booksea.xml

/**
 * Created by IntelliJ IDEA.
 * User: Sufeng
 * Date: 12-9-1
 * Time: 下午12:51
 * To change this template use File | Settings | File Templates.
 */

import _root_.java.io.Reader
import _root_.org.htmlcleaner.{HtmlCleaner, DomSerializer}

class HTMLCleanerFactoryAdapter extends DOMFactoryAdapter
with HTMLFactoryAdapter {

  private val cleaner = new HtmlCleaner
  private val props = cleaner.getProperties()
  props.setNamespacesAware(true)
  private val serializer = new DomSerializer(props, true)

  def getDOM(reader: Reader) = {
    val node = cleaner.clean(reader)
    serializer.createDOM(node);
  }
}

